package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;


/**
 * The persistent class for the CONTACTS database table.
 * 
 */
@Entity
@Table(name="CONTACTS")
@NamedQuery(name="Contact.findAll", query="SELECT c FROM Contact c")
public class Contact implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(initialValue=1,allocationSize=1,name="CONTACTS_CONTID_GENERATOR", sequenceName="SEQ_14")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CONTACTS_CONTID_GENERATOR")
	@Column(name="CONT_ID")
	private long contId;

	@Column(name="CONT_EMAIL")
	private String contEmail;

	@Column(name="CONT_IMG")
	private String contImg;

	@Column(name="CONT_KINDS")
	private BigDecimal contKinds;

	@Column(name="CONT_NAME")
	private String contName;

	@Column(name="CONT_PHONE")
	private String contPhone;

	@Column(name="CUST_ID")
	private Long custId;

	@Column(name="CUST_NAME")
	private String custName;

	//bi-directional many-to-one association to Contactsday
	@ManyToOne
	@JoinColumn(name="CDAY_ID")
	private Contactsday contactsday;

	//bi-directional many-to-one association to Customerinfo
	@ManyToOne
	@JoinColumn(name="CUS_CUST_ID")
	private Customerinfo customerinfo;

	//bi-directional many-to-one association to Contactsday
	@OneToMany(mappedBy="contact")
	private List<Contactsday> contactsdays;

	//bi-directional many-to-one association to Customerinfo
	@OneToMany(mappedBy="contact")
	private List<Customerinfo> customerinfos;

	public Contact() {
	}

	public long getContId() {
		return this.contId;
	}

	public void setContId(long contId) {
		this.contId = contId;
	}

	public String getContEmail() {
		return this.contEmail;
	}

	public void setContEmail(String contEmail) {
		this.contEmail = contEmail;
	}

	public String getContImg() {
		return this.contImg;
	}

	public void setContImg(String contImg) {
		this.contImg = contImg;
	}

	public BigDecimal getContKinds() {
		return this.contKinds;
	}

	public void setContKinds(BigDecimal contKinds) {
		this.contKinds = contKinds;
	}

	public String getContName() {
		return this.contName;
	}

	public void setContName(String contName) {
		this.contName = contName;
	}

	public String getContPhone() {
		return this.contPhone;
	}

	public void setContPhone(String contPhone) {
		this.contPhone = contPhone;
	}

	public Long getCustId() {
		return this.custId;
	}

	public void setCustId(Long custId) {
		this.custId = custId;
	}

	public String getCustName() {
		return this.custName;
	}

	public void setCustName(String custName) {
		this.custName = custName;
	}

	public Contactsday getContactsday() {
		return this.contactsday;
	}

	public void setContactsday(Contactsday contactsday) {
		this.contactsday = contactsday;
	}

	public Customerinfo getCustomerinfo() {
		return this.customerinfo;
	}

	public void setCustomerinfo(Customerinfo customerinfo) {
		this.customerinfo = customerinfo;
	}

	public List<Contactsday> getContactsdays() {
		return this.contactsdays;
	}

	public void setContactsdays(List<Contactsday> contactsdays) {
		this.contactsdays = contactsdays;
	}

	
	public Contactsday addContactsday(Contactsday contactsday) {
		getContactsdays().add(contactsday);
		contactsday.setContact(this);

		return contactsday;
	}

	public Contactsday removeContactsday(Contactsday contactsday) {
		getContactsdays().remove(contactsday);
		contactsday.setContact(null);

		return contactsday;
	}

	public List<Customerinfo> getCustomerinfos() {
		return this.customerinfos;
	}

	public void setCustomerinfos(List<Customerinfo> customerinfos) {
		this.customerinfos = customerinfos;
	}

	public Customerinfo addCustomerinfo(Customerinfo customerinfo) {
		getCustomerinfos().add(customerinfo);
		customerinfo.setContact(this);

		return customerinfo;
	}

	public Customerinfo removeCustomerinfo(Customerinfo customerinfo) {
		getCustomerinfos().remove(customerinfo);
		customerinfo.setContact(null);

		return customerinfo;
	}

	public Contact(long contId, String contEmail, String contImg, BigDecimal contKinds, String contName,
			String contPhone, Long custId, String custName, Contactsday contactsday, Customerinfo customerinfo,
			List<Contactsday> contactsdays, List<Customerinfo> customerinfos) {
		super();
		this.contId = contId;
		this.contEmail = contEmail;
		this.contImg = contImg;
		this.contKinds = contKinds;
		this.contName = contName;
		this.contPhone = contPhone;
		this.custId = custId;
		this.custName = custName;
		this.contactsday = contactsday;
		this.customerinfo = customerinfo;
		this.contactsdays = contactsdays;
		this.customerinfos = customerinfos;
	}

	public Contact(long contId, String contEmail, String contImg, BigDecimal contKinds, String contName,
			String contPhone, Long custId, String custName) {
		super();
		this.contId = contId;
		this.contEmail = contEmail;
		this.contImg = contImg;
		this.contKinds = contKinds;
		this.contName = contName;
		this.contPhone = contPhone;
		this.custId = custId;
		this.custName = custName;
	}

}